//用户相关
import http from '../src/utils/http'

//登录
export function Logins(username: string | undefined, password: string | undefined) {
    return http.post('/login', {
        userName: username,
        userPassword: password
    })
}

//修改密码
export function ResetPassword(newPassword: string | undefined, userName: string | undefined,code: string | undefined) {
    return http.put('/user/password', {
        newPassword,
        userName,
        code:Number(code)
    })
}

//注册
export function Register(userName: string | undefined, userPassword: string | undefined, email: string | undefined,code: string | undefined) {
    return http.post('/register', {
        userName,
        userPassword,
        email, 
        code:Number(code)
    })
}

//发送验证码
export function sendCode(email: string | undefined) {
    return http.get('/code', {
        params: {
            email: email
        }
    })
}

//获取Token
export function GetToken() {
    return http.get('/token')
}
